<template>
	<view class="content">
		<view class="hei20"></view>
		<view class="wid90 mar bacFFF borRad20" style="padding: 25rpx 0;">
			<view class=" wid90 mar">
				<view class="dis disAl">
					<view style="width: 25%;height: 128rpx;">
						<image :src="url+list.avatar" class="borRad50 hei100" style="width: 128rpx;"></image>
					</view>
					<view style="width: 75%;">
						<view class="dis disAl disJuB">
							<view class="foSi40 fowe600">{{list.nickname}}</view>
							<view class="foSi25 fowe600" style="color: #37BCC3;">{{list.level_name}}</view>
						</view>
						<view class="foSi30 fowe600 mar-top10">{{list.mobile}}</view>
						<view class="foSi20 mar-top10" style="opacity: 0.8;">注册时间：{{list.createtime}}</view>
					</view>
				</view>
			</view>
			<view class="xia mar-top30"></view>
			<view class="mar-top20 wid80 mar dis fowe600" style="justify-content: space-around;">
				<view class="textCen">
					<view class="foSi30">{{list.money}}</view>
					<view class="mar-top10 foSi20">钱包</view>
				</view>
				<view class="textCen">
					<view class="foSi30">{{list.coupon_log_count}}</view>
					<view class="mar-top10 foSi20">优惠券</view>
				</view>
			</view>
		</view>
		<view class="wid90 mar bacFFF borRad20 mar-top30 foSi30">
			<view style="height: 50rpx;"></view>
			<view class="wid90 mar fowe600">
				<view class=" dis disAl disJuB">
					<view style="opacity: 0.7;">绑定手机</view>
					<view style="color: #010101;">{{list.mobile}}</view>
				</view>
				<view class="mar-top30 dis disAl disJuB">
					<view style="opacity: 0.7;">会员生日</view>
					<view style="color: #010101;">{{list.birthday?list.birthday:'暂无'}}</view>
				</view>
				<view class="mar-top30 dis disAl disJuB">
					<view style="opacity: 0.7;">会员性别</view>
					<view style="color: #010101;">{{list.sex == 0?'男':'女'}}</view>
				</view>
			</view>
			<view style="height: 50rpx;"></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				list: '',
				id: '',
				yuan_userinfo: '',
				deductiom: 0,
				tanOne: false,
				type: 0,
				value: '',
				notes: ''
			}
		},
		onLoad(option) {
			this.yuan_userinfo = uni.getStorageSync('yuan_userinfo')
			this.id = option.id
			this.getList()
		},
		onShow() {
			this.getList()
		},
		methods: {
			guanbi(){
				this.tanOne = false
			},
			getOne(type){
				var i = type == 1?6:type == 2?9:type == 3?7:8
				var yuan_userinfo = uni.getStorageSync('yuan_userinfo')
				if(yuan_userinfo.counterpoise.indexOf(i) != -1){
					this.type = type
					this.value = ''
					this.notes = ''
					this.tanOne = true
				}else{
					uni.showToast({title: '暂无权限',icon: 'none',duration: 1000});
				}
			},
			getList() {
				var that = this;
				uni.request({
					url: that.global.url + '/api/qianyu_petrol/gasstation_clerk_user_info',
					method: "POST",
					header: {
						'site-id': that.global.site_id,//自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data: {
						id: that.id
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							that.list = result.data
							that.deductiom = (result.data.point_deduction_sum-0) + (result.data.integralorder_sum-0) + result.data.integral
						}
					}
				})
			},
			baocun() {
				var that = this;
				if(!that.value){
					return uni.showToast({title: '请输入输入更改数值',icon: 'none',duration: 1000});
				}
				uni.request({
					url: that.global.url + '/api/qianyu_petrol/gasstation_clerk_operate_user',
					method: "POST",
					header: {
						'site-id': that.global.site_id,//自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data: {
						'gas_station_id': that.yuan_userinfo.gas_station_id,
						'clerk_id' : that.yuan_userinfo.id,
						'id' : that.list.id,
						'type' : that.type,
						'value' : that.value,
						'notes' : that.notes
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							that.tanOne = false
							that.getList()
						}
					}
				})
			},
			tiaozhuan(url,i) {
				var yuan_userinfo = uni.getStorageSync('yuan_userinfo')
				if(yuan_userinfo.counterpoise.indexOf(i) != -1){
					uni.navigateTo({
						url: url
					})
				}else{
					uni.showToast({title: '暂无权限',icon: 'none',duration: 1000});
				}
			}
		}
	}
</script>

<style>
	.content {
		background: #F8F9FD;
		height: 100vh;
	}
	.xia{
		height: 1rpx;
		background-color: #E5E5E5;
	}
	.zhezhao {
		background-color: rgb(0, 0, 0, 0.6);
		top: 0;
	}
	
	.tan {
		width: 546rpx;
		background-color: #fff;
	}
</style>
